//
//  JMTrashController.m
//  PhotoLock
//
//  Created by 赵俊明 on 2017/7/15.
//  Copyright © 2017年 赵俊明. All rights reserved.
//

#import "JMTrashController.h"
#import "JMAlbumModel.h"
#import "JMTrashDetailController.h"

@interface JMTrashController ()

@end

@implementation JMTrashController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    NSArray *types = @[@"Photos", @"Videos"];
    NSArray *count = @[@"30 Photos", @"20 Videos"];
    NSArray *imags = @[@"play", @"play"];
    
    for (int i = 0; i < imags.count; i ++) {
        
        JMAlbumModel *model = [[JMAlbumModel alloc] init];
        model.albumType = types[i];
        model.albumCount = count[i];
        model.leftImage = imags[i];
        [self.dataSource addObject:model];
    }
    
    [self.collection reloadData];
    
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    JMAlbumCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:collectionID forIndexPath:indexPath];
    cell.collection = collectionView;
    cell.model = self.dataSource[indexPath.row];
    return cell;
}

#pragma mark UICollectionViewDelegate
// 选中某item
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    JMTrashDetailController *trash = [[JMTrashDetailController alloc] init];
    [self.tabBarController.navigationController pushViewController:trash animated:YES];
}

- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
    return CGSizeMake(self.view.width-20, self.view.width/4);
}

- (void)share:(NSIndexPath *)indexPath
{
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
